
#ifndef __UDP_SEND_H
#define __UDP_SEND_H

#include <vector>
#include <apr.h>
#include <apr_file_io.h>
#include <apr_portable.h>
#include "../iface/APRInterface.h"
#include "../aprtools/APRFuture.h"
#include "netgeneral.h"

/** A class for sending UDP datagrams. */
class UDPSend
{
   public:
      UDPSend(const char *ihostname, int iportno, apr_pool_t *imp);
      ~UDPSend();
      apr_size_t sendPacket(const uint8_t *buffer, apr_size_t length);
   protected:
      /** Is this a valid socket. */
      int isvalid;
      /** The Berkeley socket descriptor (low-level socket descriptor) for the client socket. */
      apr_os_sock_t berk_socket_des;
      /** The APR socket structure for the client socket. */
      apr_socket_t *tsocket;
      /** The address of the remote receiver. */
      apr_sockaddr_t *addrstruct;
      /** The memory pool from which to allocate service for the UDP sender. */
      apr_pool_t *mp;
      /** Maximum size of datagrams. */
      int maxdatalen;
};

#endif
